﻿<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/Master_Page/Master_IPORT.Master" CodeBehind="frm_VesselOnPort.aspx.vb" Inherits="I_PORT.frm_VesselOnPort" 
    title="IRPC INTELLIGENT PORT SERVICE" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Src="~/Control/Confirm.ascx" TagName="Confirm1" TagPrefix="Confirm" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
   <ContentTemplate>
   <script type="text/javascript" language="javascript" >
           function closeModal(type) {
           // document.getElementById('ctl00_contentplaceholder1_framePopup').src = 'about:blank';
           if(type == '1')
           {
            var mpu = $find('ctl00_ContentPlaceHolder1_ModalPopupExtender1');
            mpu.hide();
            }
            else
            {
            var mpu = $find('ctl00_ContentPlaceHolder1_ModalPopupExtender1');
            mpu.hide();
            document.getElementById('ctl00_contentplaceholder1_btnLoad').click();
            }
           
        }
           function checkNumber(e)
{
var keycode;

if (window.event) keycode = window.event.keyCode; // ใช้ IE อ่ะ

else if (e) keycode = e.which; // ใช้ Firefox เน่าะ

 if (((keycode > 47) && (keycode < 58))||(keycode == 190)||(keycode == 46))
 {
 return true;
 }
return false;
}
function clickButton(e, buttonid) {

    var evt = e ? e : window.event;
    var bt = document.getElementById(buttonid);
    if (bt) {
        if (evt.keyCode == 13) {
            bt.click();
            return false;
        }
    }
}
   </script>
<style type="text/css">
    td.locked, th.locked {
position:relative;    
left:expression((this.parentElement.parentElement.parentElement.parentElement.scrollLeft-2)+'px');
}   
</style>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
   <tr>
     <td>
        <asp:Panel ID="PanelBookingItem" runat="server">
          <table width="100%" border="0" cellpadding="2" cellspacing="0">
          <tr>
                 <td style="height:5px;"><img src="../Image/space.gif" /></td>
          </tr>
          <tr>
             <td align="left">
                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                   <tr>
                       <td valign="top">
                          <table width="100%" border="0" cellpadding="2" cellspacing="0">
                             <tr>
                                <td align="right" style="width:100px;"><asp:Label ID="labelbooking" runat="server" SkinID="lbtxt" Text="Booking No. :" ></asp:Label>&nbsp;</td>
                                <td align="left">
                                    <asp:TextBox ID="txtBooking_no" runat="server" ></asp:TextBox>
                                </td>
                             </tr>
                             <tr>
                                <td align="right" style="width:100px;"><asp:Label ID="label4" runat="server" SkinID="lbtxt" Text="Ship's Name :" ></asp:Label>&nbsp;</td>
                                <td align="left">
                                    <asp:TextBox ID="txtShipName" runat="server" Width="80%" ></asp:TextBox>
                                </td>
                             </tr>
                              <tr>
                                <td align="right" style="width:100px;"><asp:Label ID="label12" runat="server" SkinID="lbtxt" Text="สถานะ :" ></asp:Label>&nbsp;</td>
                                <td align="left">
                                   <asp:DropDownList ID="ddlStatus" runat="server" SkinID="ddl">
                                     <asp:ListItem Value="0"><--All--></asp:ListItem>
                                     <asp:ListItem Value="1">Approve</asp:ListItem>
                                     <asp:ListItem Value="2">Not Approve</asp:ListItem>
                                   </asp:DropDownList>
                                </td>
                             </tr>
                             <tr>
                                <td align="right" style="width:100px;">&nbsp;</td>
                                <td align="left">
                                    <asp:Button ID="btnSearch" runat="server" Text="ค้นหา" CssClass="ButtonStyle" />
                                </td>
                             </tr>
                          </table>
                       </td>
                       <td valign="top">
                       <table width="100%" border="0" cellpadding="2" cellspacing="0">
                             <tr>
                                <td align="right" style="width:100px;"><asp:Label ID="label5" runat="server" SkinID="lbtxt" Text="PORT :" ></asp:Label>&nbsp;</td>
                                <td align="left">
                                    <asp:DropDownList ID="ddlPORT" runat="server" SkinID="ddl" >
                                       <asp:ListItem Value="0">All</asp:ListItem>
                                       <asp:ListItem Value="L">Liquid</asp:ListItem>
                                       <asp:ListItem Value="B">Bulk</asp:ListItem>
                                    </asp:DropDownList>
                                </td>
                             </tr>
                             <tr>
                                <td align="right" style="width:100px;"><asp:Label ID="label6" runat="server" SkinID="lbtxt" Text="Main Agent :" ></asp:Label>&nbsp;</td>
                                <td align="left">
                                    <asp:TextBox ID="txtAgent" runat="server" Width="80%" ></asp:TextBox>
                                </td>
                             </tr>
                              <tr>
                                <td align="right" style="width:100px;"><asp:Label ID="label13" runat="server" SkinID="lbtxt" Text="ประเภท :" ></asp:Label>&nbsp;</td>
                                <td align="left">
                                   <asp:DropDownList ID="ddlTypeBOoking" runat="server" SkinID="ddl">
                                     <asp:ListItem Value="0"><--All--></asp:ListItem>
                                     <asp:ListItem Value="1">Vessel</asp:ListItem>
                                     <asp:ListItem Value="2">Barge</asp:ListItem>
                                     <asp:ListItem Value="3">Other Service</asp:ListItem>
                                   </asp:DropDownList>
                                </td>
                             </tr>
                             <tr>
                              <td style="width:100px;" align="right"><asp:Label ID="Label20MR" runat="server" SkinID="lbtxt" Text="Berth :"></asp:Label>&nbsp;</td>
                              <td align="left"><asp:TextBox ID="txtDateFromM" runat="server" Width="80px" onkeypress="return false;" ></asp:TextBox>&nbsp;<asp:ImageButton ID="ImgDateSearchM" runat="server" ImageUrl="~/Image/calendar.png" />
                                <asp:CalendarExtender ID="CalendarExtender5" runat="server" TargetControlID="txtDateFromM" Format="dd MMM yyyy" PopupButtonID="ImgDateSearchM"></asp:CalendarExtender>
                              </td>
                           </tr>
                          </table>
                       </td>
                   </tr>
                </table>
             </td>
          </tr>
          <tr>
                 <td colspan="2" align="center">
                 <asp:Panel ID="panelGridItem" runat="server" Width="900px" ScrollBars="Horizontal">
                 <asp:GridView ID="gridItem" runat="server" SkinID="gridblue" DataKeyNames="Type_Pay_Product,Status,Booking_Code,Booking_name,Vehicle_no,Vehicle_Text,Booking_no,Date_From,Date_To,MAgent_no,MAgent_name,SAgent_no,SAgent_name,MKT_Product,MKT_Custom,MKT_Finance,Booking_Date,Booking_Time,VPS_approve,MRI_approve,Marketing_approve,Vps_Acknowledge,MKT_Acknowledge,Remark_VPS,Remark_MRI,Vehicle_Destination,Vehicle_TypeBuy,Demurrage,Demurrage_Money,BunkerFO_Point,BunkerDO_Point,PORT,File_Upload,SELLER,BUYER,Product_Unit,Shifting,Owner_Product_no,Owner_Product_name,Credit_Limit,Payin,Vehicle_CNTRY"
                                                AutoGenerateColumns="False" >
                                                <PagerTemplate>
                                                    <table>
                                                        <tr>
                                                            <td>
                                                                <asp:ImageButton ID="ImgFirst" runat="server" Height="22px" ImageUrl="../Image/arrow-first.gif"
                                                                    OnCommand="Paginate" CommandArgument="First" CommandName="Page" />
                                                            </td>
                                                            <td>
                                                                <asp:ImageButton ID="ImgBack" runat="server" Height="22px" ImageUrl="../Image/arrow-back.gif"
                                                                    OnCommand="Paginate" CommandArgument="Prev" CommandName="Page" />
                                                            </td>
                                                            <td valign="top">
                                                                Page
                                                                <asp:DropDownList ID="ddlPage" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlPage_SelectedIndexChanged">
                                                                </asp:DropDownList>
                                                                of
                                                                <asp:Label ID="lbPageCount" runat="server" Text="Label"></asp:Label>
                                                            </td>
                                                            <td>
                                                                <asp:ImageButton ID="ImgNext" runat="server" Height="22px" ImageUrl="../Image/arrow-next.gif"
                                                                    OnCommand="Paginate" CommandArgument="Next" CommandName="Page" />
                                                            </td>
                                                            <td>
                                                                <asp:ImageButton ID="ImgEnd" runat="server" Height="22px" ImageUrl="../Image/arrow-end.gif"
                                                                    OnCommand="Paginate" CommandArgument="Last" CommandName="Page" />
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </PagerTemplate>
                                                <Columns>
                                                    <asp:TemplateField HeaderText="BOOKING NO." ItemStyle-Wrap="false">
                                                        <ItemTemplate>
                                                            <asp:LinkButton ID="LinkBooking" runat="server" Text="<%# Bind('Booking_no') %>"
                                                                CommandArgument="<%# Container.DataItemIndex %>" CommandName="Edit"></asp:LinkButton>
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="Billing No." ItemStyle-Width="40px">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lbBilling" runat="server" Font-Names="Tahoma" Text="" ForeColor="Black"></asp:Label>
                                                            <asp:Label ID="lbBillingColor" runat="server" Font-Names="Tahoma" Text="" Font-Bold="true" ForeColor="Blue"></asp:Label>
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:BoundField HeaderText="Ship's Name" DataField="Vehicle_Text" ItemStyle-Wrap="false" />
                                                    <asp:BoundField HeaderText="PORT"  ItemStyle-Wrap="false" />
                                                    <asp:BoundField HeaderText="BERTH" ItemStyle-Wrap="false" />
                                                     <asp:BoundField HeaderText="UNBERTH" ItemStyle-Wrap="false" />
                                                    <asp:BoundField HeaderText="Lay Time" Visible="false" ItemStyle-Wrap="false" />
                                                    <asp:BoundField HeaderText="Product" ItemStyle-Wrap="false" />
                                                    <asp:BoundField HeaderText="MT." ItemStyle-Wrap="false" />
                                                    <asp:TemplateField HeaderText="Credit Limit" ItemStyle-Width="40px">
                                                        <ItemTemplate>
                                                            <asp:Image ID="imgCredit" runat="server" />
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="Status" ItemStyle-Width="40px">
                                                        <ItemTemplate>
                                                            <asp:Image ID="imgStatus" runat="server" />
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:BoundField HeaderText="AGENT/CUSTOMER" DataField="Owner_Product_name" ItemStyle-Wrap="false" />
                                                    <asp:BoundField HeaderText="TERM" ItemStyle-Wrap="false" />
                                                    <asp:BoundField HeaderText="ESTIMATE" ItemStyle-Wrap="false" />
                                                    <asp:BoundField HeaderText="ACTUAL" ItemStyle-Wrap="false" />
                                                </Columns>
                                            </asp:GridView>
                 </asp:Panel>
                     <asp:Label ID="lbAlert" runat="server" Text="" Font-Names="Tahoma" style="color:Red; font-size:16px;"></asp:Label>
                 </td>
              </tr>
          </table>
        </asp:Panel>
        <asp:Panel ID="PanelOperation" runat="server" Visible="false" >
           <table width="100%" border="0" cellpadding="2" cellspacing="0">
           <tr>
             <td style="width:20%;" align="right"><asp:Label ID="Label7" runat="server" SkinID="lbtxt" Text="Booking No. :"></asp:Label>&nbsp;</td>
             <td align="left">
                 <asp:Label ID="lbBooking_no" runat="server" SkinID="lbtxt" Text=""></asp:Label>
             </td>
           </tr>
           <tr>
             <td style="width:20%;" align="right"><asp:Label ID="Label8" runat="server" SkinID="lbtxt" Text="AGENT/CUSTOMER :"></asp:Label>&nbsp;</td>
             <td align="left">
                <asp:Label ID="lbAgent" runat="server" SkinID="lbtxt" Text=""></asp:Label>
             </td>
           </tr>
           <tr>
             <td style="width:20%;" align="right"><asp:Label ID="Label10" runat="server" SkinID="lbtxt" Text="BERTHED - DEPARTED :"></asp:Label>&nbsp;</td>
             <td align="left">
                <asp:Label ID="lbBerth" runat="server" SkinID="lbtxt" Text=""></asp:Label>
             </td>
           </tr>
            <tr>
             <td style="width:20%;" align="right"><asp:Label ID="Label9" runat="server" SkinID="lbtxt" Text="การชำระ :"></asp:Label>&nbsp;</td>
             <td align="left">
                <asp:Label ID="lbType_Pay" runat="server" SkinID="lbtxt" Text=""></asp:Label>
             </td>
           </tr>
           <tr id="rowShifting" runat="server" visible="false">
             <td style="width:20%;" align="right">&nbsp;</td>
             <td align="left">
                <asp:Label ID="lbShifting" runat="server" SkinID="lbtxt" Text="Shifting"></asp:Label>
             </td>
           </tr>
           <tr id="rowAddTariff" runat="server">
             <td style="width:20%;" align="right"><asp:Label ID="lbTariff" runat="server" SkinID="lbtxt" Text="Tariff :"></asp:Label>&nbsp;</td>
             <td align="left">
                 <asp:Button ID="btnTariff" runat="server" Text="เพิ่ม Tariff" CssClass="ButtonStyle" />
             </td>
           </tr>
           <tr>
               <td style="width:20%;" align="right" valign="top"><asp:Label ID="Label1" runat="server" SkinID="lbtxt" Text="Tariff :"></asp:Label>&nbsp;</td>
               <td align="left">
                 <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                <asp:GridView ID="GridMat" runat="server" SkinID="gridblueNoPage"  DataKeyNames="MATERIAL,Booking_no,Text_line,data4,Unit,Count,MAT_Default,KBETR,KONWA,MAT_Relation,MAT_Compute,MAT_Free,data1,data2,data3,New_Old" AutoGenerateColumns="False">
                     <Columns>
                         <asp:TemplateField HeaderText="คำนวณ" ItemStyle-Width="38px" Visible="false">
                             <ItemTemplate>
                                 <asp:CheckBox ID="chk" runat="server" Checked="true" AutoPostBack="true" OnCheckedChanged="chk_CheckedChanged" />
                             </ItemTemplate>
                             <ItemStyle HorizontalAlign="Center" />
                         </asp:TemplateField>
                         <asp:BoundField HeaderText="Code" DataField="MATERIAL" />
                         <asp:BoundField HeaderText="Description" DataField="Text_line" ItemStyle-HorizontalAlign="Center" />
                         <asp:BoundField HeaderText="QTY" DataField="data1" ItemStyle-HorizontalAlign="Center" />
                         <asp:BoundField HeaderText="RATE/UNIT" DataField="data2" ItemStyle-HorizontalAlign="Center" />
                         <asp:BoundField HeaderText="QTY" DataField="data3" ItemStyle-HorizontalAlign="Center" />
                         <asp:TemplateField HeaderText="AMOUNT" ItemStyle-Width="80px">
                             <ItemTemplate>
                                 <asp:TextBox ID="txtData4" runat="server" Text="<%# Bind('data4')%>" Width="77px" onkeypress="return checkNumber(this);" AutoPostBack="true" OnTextChanged="txtData4_TextChanged" ></asp:TextBox>
                             </ItemTemplate>
                             <ItemStyle HorizontalAlign="Center" />
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="Owner1" ItemStyle-Width="60px" Visible="false" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkOwner1" runat="server" Checked="true" />
                             </ItemTemplate>
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="Owner2" ItemStyle-Width="60px" Visible="false" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkOwner2" runat="server" />
                             </ItemTemplate>
                         </asp:TemplateField>
                          <asp:TemplateField HeaderText="Owner3" ItemStyle-Width="60px" Visible="false" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkOwner3" runat="server" />
                             </ItemTemplate>
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="Owner4" ItemStyle-Width="60px" Visible="false" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkOwner4" runat="server" />
                             </ItemTemplate>
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="Owner5" ItemStyle-Width="60px" Visible="false" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkOwner5" runat="server" />
                             </ItemTemplate>
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="Owner6" ItemStyle-Width="60px" Visible="false" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkOwner6" runat="server" />
                             </ItemTemplate>
                         </asp:TemplateField>
                     </Columns>
                 </asp:GridView>
                    </ContentTemplate>
                 </asp:UpdatePanel>
               </td>
            </tr>
            <tr>
               <td style="width:20%;" align="right" valign="top">&nbsp;</td>
               <td align="left">
                 <asp:UpdatePanel ID="UpdateTariff" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                <asp:GridView ID="gridTariff" runat="server" SkinID="gridblueNoPage" DataKeyNames="Material,MAT_Default,KBETR,KONWA,MAT_Relation,New_old" Visible="false" AutoGenerateColumns="False">
                     <Columns>
                         <asp:TemplateField HeaderText="คำนวณ" ItemStyle-Width="38px" Visible="false">
                             <ItemTemplate>
                                 <asp:CheckBox ID="chk" runat="server" />
                             </ItemTemplate>
                             <ItemStyle HorizontalAlign="Center" />
                         </asp:TemplateField>
                         <asp:BoundField HeaderText="รหัส" DataField="MATERIAL" />
                         <asp:BoundField HeaderText="ชื่อ" DataField="Text_line" ItemStyle-HorizontalAlign="Center" />
                         <asp:TemplateField HeaderText="Rate" ItemStyle-Width="50px">
                             <ItemTemplate>
                                 <asp:TextBox ID="txtRate" runat="server" Text="<%# Bind('data2')%>" Width="47px" onkeypress="return checkNumber(this);" ></asp:TextBox>
                             </ItemTemplate>
                             <ItemStyle HorizontalAlign="Center" />
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="จำนวน" ItemStyle-Width="50px">
                             <ItemTemplate>
                                 <asp:TextBox ID="txtCount" runat="server" Text="<%# Bind('data3')%>" Width="47px" onkeypress="return checkNumber(this);" ></asp:TextBox>
                             </ItemTemplate>
                             <ItemStyle HorizontalAlign="Center" />
                         </asp:TemplateField>
                         <asp:BoundField HeaderText="หน่วย" DataField="Unit" ItemStyle-HorizontalAlign="Center" />
                         <asp:TemplateField HeaderText="ลบ" ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                 <asp:ImageButton ID="imgdelete" CommandName="cmddelete" CommandArgument="<%# Container.DataItemIndex %>" OnClientClick="showConfirm(this); return false;"  runat="server" ImageUrl="~/Image/cancel-24.gif" />
                             </ItemTemplate>
                         </asp:TemplateField>
                     </Columns>
                 </asp:GridView>
                    </ContentTemplate>
                 </asp:UpdatePanel>
               </td>
            </tr>
            <tr>
               <td style="width:20%;" align="right" valign="top"><asp:Label ID="lbtxt" runat="server" SkinID="lbtxt" Text="ยอดรวมทั้งหมด :" ></asp:Label>&nbsp;</td>
               <td align="left">
                    <asp:Label ID="lbNet" runat="server" SkinID="lbtxt" ></asp:Label>&nbsp;<asp:Label ID="Label2" runat="server" SkinID="lbtxt" Text="Baht" ></asp:Label>
               </td>
            </tr>
            <tr id="rowSoldTo" runat="server" visible="false">
               <td style="width:20%;" align="right" valign="top"><asp:Label ID="Label3" runat="server" SkinID="lbtxt" Text="Sold To :"></asp:Label>&nbsp;</td>
               <td align="left"><asp:TextBox ID="txtid" runat="server" Width="350px" AutoPostBack="true"></asp:TextBox>
               <asp:AutoCompleteExtender  runat="server" ID="AutoCompleteExtender1" BehaviorID="AutoCompleteEx2" CompletionInterval="50"
                     TargetControlID="txtid" ServicePath="../WebService/AutoComplete_IPORT.asmx" MinimumPrefixLength="1" 
                    ServiceMethod="GetCustomer" CompletionListCssClass="autocomplete_completionListElement"
                CompletionListItemCssClass="autocomplete_listItem"
                CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" >
                <Animations>
                    <OnShow>
                        <Sequence>
                            <%-- Make the completion list transparent and then show it --%>
                            <OpacityAction Opacity="0" />
                            <HideAction Visible="true" />
                            
                            <%--Cache the original size of the completion list the first time
                                the animation is played and then set it to zero --%>
                            <ScriptAction Script="
                                // Cache the size and setup the initial size
                                var behavior = $find('AutoCompleteEx2');
                                if (!behavior._height) {
                                    var target = behavior.get_completionList();
                                    behavior._height = target.offsetHeight - 2;
                                    target.style.height = '0px';
                                }" />
                            
                            <%-- Expand from 0px to the appropriate size while fading in --%>
                            <Parallel Duration=".3">
                                <FadeIn />
                                <Length PropertyKey="height" StartValue="0" EndValueScript="$find('AutoCompleteEx2')._height" />
                            </Parallel>
                        </Sequence>
                    </OnShow>
                    <OnHide>
                        <%-- Collapse down to 0px and fade out --%>
                        <Parallel Duration=".3">
                            <FadeOut />
                            <Length PropertyKey="height" StartValueScript="$find('AutoCompleteEx2')._height" EndValue="0" />
                        </Parallel>
                    </OnHide>
                </Animations>
                 </asp:AutoCompleteExtender>
               
               </td>
            </tr>
            <tr id="rowBillTo" runat="server" visible="false">
               <td style="width:20%;" align="right" valign="top"><asp:Label ID="Label30" runat="server" SkinID="lbtxt" Text="Bill To :"></asp:Label>&nbsp;</td>
               <td align="left"><asp:TextBox ID="txtBillTo" runat="server" Width="350px"></asp:TextBox>
                                                    <asp:AutoCompleteExtender runat="server" ID="AutoCompleteExtender3" BehaviorID="AutoCompleteExBill"
                                                        CompletionInterval="50" TargetControlID="txtBillTo" ServicePath="../WebService/AutoComplete_IPORT.asmx"
                                                        MinimumPrefixLength="1" ContextKey="" ServiceMethod="GetBillTo" CompletionListCssClass="autocomplete_completionListElement"
                                                        CompletionListItemCssClass="autocomplete_listItem" CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem">
                                                        <Animations>
                    <OnShow>
                        <Sequence>
                            <%-- Make the completion list transparent and then show it --%>
                            <OpacityAction Opacity="0" />
                            <HideAction Visible="true" />
                            
                            <%--Cache the original size of the completion list the first time
                                the animation is played and then set it to zero --%>
                            <ScriptAction Script="
                                // Cache the size and setup the initial size
                                var behavior = $find('AutoCompleteExBill');
                                if (!behavior._height) {
                                    var target = behavior.get_completionList();
                                    behavior._height = target.offsetHeight - 2;
                                    target.style.height = '0px';
                                }" />
                            
                            <%-- Expand from 0px to the appropriate size while fading in --%>
                            <Parallel Duration=".3">
                                <FadeIn />
                                <Length PropertyKey="height" StartValue="0" EndValueScript="$find('AutoCompleteExBill')._height" />
                            </Parallel>
                        </Sequence>
                    </OnShow>
                    <OnHide>
                        <%-- Collapse down to 0px and fade out --%>
                        <Parallel Duration=".3">
                            <FadeOut />
                            <Length PropertyKey="height" StartValueScript="$find('AutoCompleteExBill')._height" EndValue="0" />
                        </Parallel>
                    </OnHide>
                          </Animations>
              </asp:AutoCompleteExtender>
               
               </td>
            </tr>
            <tr id="rowDueDate" runat="server" visible="false">
               <td style="width:20%;" align="right" valign="top"><asp:Label ID="Label11" runat="server" SkinID="lbtxt" Text="Due Date :"></asp:Label>&nbsp;</td>
               <td align="left"><asp:TextBox ID="txtDueDate" runat="server" Width="50px" onkeypress="return checkNumber(this);" ></asp:TextBox>     
               </td>
            </tr>
            <tr id="rowBillingDate" runat="server" visible="false">
               <td style="width:20%;" align="right" valign="top"><asp:Label ID="Label14" runat="server" SkinID="lbtxt" Text="Billing Date :"></asp:Label>&nbsp;</td>
               <td align="left"><asp:TextBox ID="txtDate" runat="server" Width="80px" onkeypress="return false;" ></asp:TextBox>&nbsp;<asp:ImageButton ID="ImgDate" runat="server" ImageUrl="~/Image/calendar.png" />&nbsp;<asp:Label ID="labelRed" runat="server" Text="** กรณีไม่ได้ระบุ Billing Date จะถือเอาวันที่ทำการ Confirm เป็น Billing Date" ForeColor="Red" ></asp:Label>
                 <asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtDate" Format="dd MMM yyyy" PopupButtonID="ImgDate"></asp:CalendarExtender>
               </td>
            </tr>
            <tr>
               <td style="width:20%;" align="right" valign="top">&nbsp;</td>
               <td align="left">
                   <table width="100%" border="0" cellpadding="0" cellspacing="0">
                     <tr>
                        <td align="left"><asp:Button ID="btnSave" runat="server" Text="บันทึก" CssClass="ButtonStyle" />
                        <asp:Button ID="btnPrint" runat="server" Text="Print Actual" CssClass="ButtonStyle" />
                        <asp:Button ID="btnPrintCNDN" runat="server" Text="Print CN/DN" CssClass="ButtonStyle" />
                        <asp:Button ID="btnBack" runat="server" Text="กลับ" CssClass="ButtonStyle" />
                        </td>
                        <td align="right"><asp:Button ID="btnComplete" runat="server" Text="ยืนยันราคา" CssClass="ButtonStyle" OnClientClick="return confirm('ยืนยันราคา ?')" />&nbsp;</td>
                     </tr>
                   </table>
               </td>
            </tr>
           </table>
        </asp:Panel>
        </td>
        </tr>
        </table>
             <asp:Button ID="btnLoad" runat="server" Text="Button" style="display:none" />
             <asp:Button ID="btnTariffTemp" runat="server" Text="Button" style="display:none" />
                <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" BackgroundCssClass="Background"
     TargetControlID="btnTariffTemp" PopupControlID="PopupAdd" >
    </asp:ModalPopupExtender>
              <asp:Panel ID="PopupAdd" runat="server" Style="display: none;">
        <table>
            <tr>
                <td>
                    <iframe runat="server" id="framePopup" class="Style-Iframe" marginheight="0px" marginwidth="0px" >
                    </iframe>
                </td>
            </tr>
        </table>
    </asp:Panel>
        </ContentTemplate>
      </asp:UpdatePanel>
</asp:Content>
